package com.yy.wga.goods.service.entity.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yy.wga.common.mysql.dto.BaseEntity;
import com.yy.wga.goods.service.typeHandler.GoodsSpuAttrJacksonTypeHandler;
import com.yy.wga.goods.service.typeHandler.GoodsSpuImgTypeHandler;
import com.yy.wga.goods.service.typeHandler.GoodsSpuJacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

/**
 * spu信息(GoodsSpu)表实体类
 *
 * @author guochao
 * @since 2024-11-06 21:54:15
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@TableName(value = "goods_spu",autoResultMap = true)
public class GoodsSpuDO extends BaseEntity {

    /**
     * 所属店铺ID
     */
    @TableField(value = "shop_appid")
    private String shopAppid;


    /**
     * 商品ID
     */
    @TableField(value = "spu_id")
    private String spuId;


    /**
     * 商品标题
     */
    @TableField(value = "title")
    private String title;

    /**
     * 商品子标题
     */
    @TableField(value = "sub_title")
    private String subTitle;

    /**
     * 商品头图URL列表
     */
    @TableField(value = "head_img", typeHandler = GoodsSpuImgTypeHandler.class)
    private List<String> headImg;

    /**
     * 详情
     */
    @TableField(value = "detail_img", typeHandler = GoodsSpuImgTypeHandler.class)
    private List<String> detailImg;


    /**
     * 库存
     */
    @TableField(value = "stock_num")
    private Integer stockNum;

    /**
     * 销售价
     */
    @TableField(value = "sale_price")
    private Integer salePrice;

    /**
     * 市场价
     */
    @TableField(value = "market_price")
    private Integer marketPrice;

    /**
     * 商品线上状态, 0初始值 5上架 6回收站 9逻辑删除 11自主下架 12售磬下架 13违规下架/风控系统下架
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 商品推广数据
     */
    @TableField(value = "product_promotion_link")
    private String productPromotionLink;


    @TableField(value = "skus", typeHandler = GoodsSpuJacksonTypeHandler.class)
    private List<Sku> skus;

    @TableField(value = "first_cate_id")
    private String firstCateId;

    @TableField(value = "second_cate_id")
    private String secondCateId;

    @TableField(value = "third_cate_id")
    private String thirdCateId;


    @Data
    public static class Sku {
        @TableField(value = "sku_id")
        private String skuId;

        @TableField(value = "thumb_img")
        private String thumbImg;

        @TableField(value = "sale_price")
        private Integer salePrice;

        @TableField(value = "stock_num")
        private int stockNum;

        @TableField(value = "sku_attrs", typeHandler = GoodsSpuAttrJacksonTypeHandler.class)
        private List<Attr> skuAttrs;
    }

    @Data
    public static class Attr {
        @TableField(value = "attr_key")
        private String attrKey;

        @TableField(value = "attr_value", typeHandler = FastjsonTypeHandler.class)
        private List<String> attrValue;
    }


}
